package com.yz.jdd.network;


import com.yz.jdd.base.entity.ExtInfo;
import com.yz.jdd.base.entity.Response_Base;
import com.yz.jdd.module.main.entity.AccountInfoBean;
import com.yz.jdd.module.main.entity.HomePageBean;
import com.yz.jdd.module.main.entity.HuabeiService;
import com.yz.jdd.module.main.entity.UserInfoBean;
import com.yz.jdd.module.settings.model.DeviceEntity;
import com.yz.jdd.module.settings.model.PayQrCode;
import com.yz.jdd.network.request.PayParams;
import com.yz.jdd.network.request.Request_AppLimitSetting;
import com.yz.jdd.network.request.Request_CloseOrder;
import com.yz.jdd.network.request.Request_OrderLiuShuiList;
import com.yz.jdd.network.request.Request_OrderTotalList;
import com.yz.jdd.network.request.Request_PayShopInfo;
import com.yz.jdd.network.request.Request_PayStatus;
import com.yz.jdd.network.request.Request_QecodeManage_listNew;
import com.yz.jdd.network.request.Request_SetShopPay;
import com.yz.jdd.network.request.Request_Status;
import com.yz.jdd.network.request.Request_Update;
import com.yz.jdd.network.request.Request_UserLogin;
import com.yz.jdd.network.request.Request_UserRegister;
import com.yz.jdd.network.request.Request_shopList;
import com.yz.jdd.network.request.Request_deviceQuery;
import com.yz.jdd.network.request.Request_switchLimitationSetting;
import com.yz.jdd.network.request.Request_upgrade;
import com.yz.jdd.network.request.Request_userSwitchSetting;
import com.yz.jdd.network.request.Requset_DeviceLogin;
import com.yz.jdd.network.request.Requset_usercenter;
import com.yz.jdd.network.response.Response_AppVoiceSet;
import com.yz.jdd.network.response.Response_BalTemp;
import com.yz.jdd.network.response.Response_BdInfo;
import com.yz.jdd.network.response.Response_CashierLiuShuiList;
import com.yz.jdd.network.response.Response_CashierOrderList;
import com.yz.jdd.network.response.Response_DeviceLogin;
import com.yz.jdd.network.response.Response_FilterCashierTotal;
import com.yz.jdd.network.response.Response_Pay;
import com.yz.jdd.network.response.Response_PayQrCode;
import com.yz.jdd.network.response.Response_PayQrCodeNew;
import com.yz.jdd.network.response.Response_PayShopInfo;
import com.yz.jdd.network.response.Response_UserLogin;
import com.yz.jdd.network.response.Response_UserSwitchSetting;
import com.yz.jdd.network.response.Response_VoiceStatus;
import com.yz.jdd.network.response.Response_access;
import com.yz.jdd.network.response.Response_accountId;
import com.yz.jdd.network.response.Response_upgrade;

import java.util.List;
import java.util.Map;

import okhttp3.Request;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;
import rx.Observable;


/**
 * Created by lkf on 2017/1/5.
 * 被观察者，需要观察的接口
 */

public interface ApiObservable {


    /***
     * 设备登录Rx 写法需要返回一个Observable被观察者
     * 设备登录接口
     *
     * @return Response_DeviceLogin
     */
    @POST("app/device/login.do")
    Observable<Response_Base<Response_DeviceLogin>> doDeviceLogin(@Body Requset_DeviceLogin
                                                                          deviceLogin);

    /***
     * 用户登录接口
     *
     * @return
     */
    @POST("app/user/login.do")
    Observable<Response_Base<Response_UserLogin>> doUserLogin(@Body Request_UserLogin
                                                                      request_userLogin);


    /**
     * 修改密码
     *
     * @param password
     * @return
     */
    @POST("newapp/setting/resetPwd.do")
    Observable<Response_Base> doModifyPwd(@Body Requset_usercenter
                                                  password);

    /**
     * 重置密码，忘记密码调用
     *
     * @param requset
     * @return
     */
    @POST("app/setting/resetPwd.do")
    Observable<Response_Base> doResetPwd(@Body Requset_usercenter
                                                 requset);


    /**
     * 验证原密码
     *
     * @param request_verifyPwd
     * @return
     */
    @POST("app/setting/verifyPwd.do")
    Observable<Response_Base> doVerifyPwd(@Body Requset_usercenter request_verifyPwd);


    /**
     * 获取验证码,发送修改手机号验证码
     *
     * @param requset_sendVerifyCode
     * @return
     */
    @POST("newapp/setting/sendVerifyCodeResetPWD.do")
    Observable<Response_Base> sendVerifyCodeModifyPhone(@Body Requset_usercenter requset_sendVerifyCode);

    /**
     * 获取验证码,发送重置密码验证码
     *
     * @param requset_sendVerifyCode
     * @return
     */
    @POST("app/setting/sendVerifyCodeResetPWD.do")
    Observable<Response_Base> sendVerifyCodeResetPWD(@Body Requset_usercenter requset_sendVerifyCode);

    /**
     * 验证验证码，通过以后可以执行下一步操作
     *
     * @param requset_usercenter
     * @return
     */
    @POST("newapp/setting/verifyCode.do")
    Observable<Response_Base> verifyCode(@Body Requset_usercenter
                                                 requset_usercenter);

    /**
     * 修改手机号
     *
     * @param requset_usercenter
     * @return
     */
    @POST("newapp/setting/modifyPhoneNum.do")
    Observable<Response_Base> modifyPhone(@Body Requset_usercenter requset_usercenter);

    /***
     * 退出登录接口
     *
     * @return
     */
    @GET("user/logout.do")
    Observable<Response_Base> doUserLogout();


    //检测版本升级
    @POST("app/version/upgrade.do")
    Observable<Response_Base<Response_upgrade>> doUpgrade(@Body Request_upgrade request_upgrade);

    //获取权限和功能列表
    @POST("app/access/get.do")
    Observable<Response_Base<Response_access>> doGetAccess();

    //上报pushId等参数
    @POST("app/device/update.do")
    Observable<Response_Base> doUpdate(@Body Request_Update request_update);

    @POST("")
    Observable<Response_Base> doUploadPicture(@Body Request request);

    @Streaming
    @GET
    Observable<ResponseBody> downloadH5zip(@Url String fileUrl);

    /**
     * @param request_userLogin
     * @return 绑定接口，请求参数和用户登录接口一样，密码用户名传空、增加phoneNum(手机号)、veryCode(验证码)
     * 返回值和用户登录接口一致
     */
    @POST("app/unionLogin/bindAccount.do")
    Observable<Response_Base<Response_UserLogin>> doBindLogin(@Body Request_UserLogin
                                                                      request_userLogin);

    /**
     * 绑定手机号 验证码接口
     *
     * @param requset_usercenter
     * @return
     */
    @POST("app/unionLogin/sendVerifyCode.do")
    Observable<Response_Base<Response_accountId>> doBindVerifyCode(@Body Requset_usercenter requset_usercenter);

    /**
     * 获取sign
     *
     * @return
     */
    @POST("app/unionLogin/sign.do")
    Observable<Response_Base> doJoinLogin();

    /***
     * 用户注册接口
     *
     * @return
     */
    @POST("app/selfSupplier/register.do")
    Observable<Response_Base<Response_UserLogin>> doRegister(@Body Request_UserRegister request_userRegister);

    /***
     * 验证码接口
     *
     * @return
     */
    @POST("app/register/sendVerify.do")
    Observable<Response_Base> doSendVerify(@Body Request_UserLogin request_userLogin);


    /**
     * 列表数据（pos 外卖 异常订单）(列表及筛选)
     *
     * @param request_orderTotalList
     * @return
     */
    @POST("newapp/order/queryTradeOrderList4App.do")
    Observable<Response_Base> doOrderList(@Body Request_OrderTotalList request_orderTotalList);
//    /**
//     * 获取订单列表
//     *
//     * @param params
//     * @return
//     */
//    @GET("newapp/order/getOrderCountList.do")
//    Observable<Response_Base> doOrderList(@QueryMap Map<String, String> params);

    /**
     * 订单筛选-查询操作人、pos sn 及二维码列表
     *
     * @param params
     * @return
     */
    @GET("newapp/order/getOrderTranscationParam.do")
    Observable<Response_Base> doGetOrderTranscationParam(@QueryMap Map<String, String> params);


    /**
     * 获取收银订单汇总列表
     */
    @POST("newapp/order/getOrderTotalList.do")
    Observable<Response_Base<Response_CashierOrderList>> doOrderTotalList(@Body Request_OrderTotalList request_orderTotalList);

//    /**
//     * 收银订单汇总数据（筛选）
//     */
//    @POST("newapp/order/getChoiceTotal.do")
//    Observable<Response_Base<Response_FilterCashierTotal>> doChoiceTotal(@Body Request_OrderTotalList request_orderTotalList);

    /**
     * 获取收银订单汇总列表 - 流水明细列表
     */
    @POST("newapp/order/getLiuShuiList.do")
    Observable<Response_Base<Response_CashierLiuShuiList>> getLiuShuiList(@Body Request_OrderLiuShuiList request_orderLiuShuiList);

    /**
     * 获取收银订单汇总列表 -  筛选
     */
    @POST("newapp/order/getOrderLiuShuiList.do")
    Observable<Response_Base<Response_FilterCashierTotal>> doOrderLiuShuiList(@Body Request_OrderLiuShuiList request_orderLiuShuiList);


    /**
     * 初始化今日数据
     *
     * @return
     *  过期 @GET("merchantApp/index/queryTodayTradeReportDataNew.do")
     */
    @GET("newapp/home/queryTodayTradeReportDataNew.do")
    Observable<Response_Base<HomePageBean>> doQueryTodayTradeReportData();

    /**
     * 获取用户信息
     *
     * @return
     */
    @GET("newapp/employee/info.do")
    Observable<Response_Base<UserInfoBean>> doInfo();

    /**
     * 获取boss账号创建时间，时间筛选
     *
     * @return
     */
    @GET("newapp/order/getBossAccount.do")
    Observable<Response_Base<AccountInfoBean>> doBossAccount();

    /**
     * 获取门店列表
     *
     * @return
     */
    @GET("newapp/order/shopList.do")
    Observable<Response_Base> doShoplist();

    /**
     * 获取可以支付的门店列表
     *
     * @return
     */
    @GET("newapp/shop/getShopSelectForPay.do")
    Observable<Response_Base> getShopSelectForPay();

    /**
     * 获取登录账号下是否有门店开通小程序套餐 的门店
     * @return
     */
    @GET("newapp/shop/getShopSelectForMarket.do")
    Observable<Response_Base>  getShopSelectForMarket();

    /**
     * 是否已经同意去口碑
     */
    @POST("newapp/moveKoubei/check.do")
    Observable<Response_Base> checkMoveKoubei();

    /**
     * 同意去口碑
     */
    @POST("newapp/moveKoubei/confirm.do")
    Observable<Response_Base> confirmMoveKoubei();

    /**
     * 获取未读消息数量
     */
    @GET("app/AppMsg/getCountForNewsCenter.do")
    Observable<Response_Base> getMsgCount();

    /**
     * 获取订单筛选条件
     */
    @GET("newapp/order/getOrderCondition.do")
    Observable<Response_Base> getOrderCondition();

    /**
     * 蓝海广告位展示
     *
     * @return
     */
    @GET("newapp/ads/lanhaiShowJudge.do")
    Observable<Response_Base> getAdsLanhaiShowJudge();

    /**
     * 语音播报设置查询
     */
    @GET("newapp/voice/status.do")
    Observable<Response_Base<Response_VoiceStatus>> getVoiceStatus();

    /**
     * 语音播报设置接口,这块需要确认一下是否有权限问题
     */
    @FormUrlEncoded
    @POST("app/voice/setting.do")
    Observable<Response_Base<Response_VoiceStatus>> setVoiceSetting(@FieldMap Map<String, Object> map);

//    /**
//     * 防逃单语音播报设置
//     */
//    @FormUrlEncoded
//    @POST("newapp/voice/cancelOrderSetting.do")
//    Observable<Response_Base> setCancelOrderSetting(@Field("status") String status);



    /**
     * 防逃单语音播报设置
     */

    @POST("newapp/setting/cancelOrderSetting.do")
    Observable<Response_Base> setCancelOrderSetting(@Body Request_Status status);

    /**
     * 获取门店码id列表
     */
    @POST("app/qrCodeManage/listNew.do")
    Observable<Response_Base<Response_PayQrCode>> qecodeManage(@Body Request_QecodeManage_listNew requestQecodeManageListNew);

    /**
     * 设置播报码id
     *
     * @param request
     * @return
     */
    @POST("app/voice/appLimitSetting.do")
    Observable<Response_Base> setAppLimitSetting(@Body Request_AppLimitSetting request);
    //==============================扫码相关==============================

    /**
     * 获取支付订单状态
     *
     * @param request_payStatus 支付状态 0：未付款，1：付款中，2：付款成功，3：付款失败
     * @return
     */
    @POST("newapp/pay/queryPayStatus.do")
    Observable<Response_Base<Response_Pay>> doGetPayStatus(@Body Request_PayStatus request_payStatus);


    /**
     * 扫码支付
     *
     * @param param
     * @return /pos/order/v2/qrcodepay.do /原金员宝
     */
    @POST("newapp/pay/barPay.do?version=1.0")
    Observable<Response_Base<Response_Pay>> doScanpay(@Body PayParams param);

    /**
     * 支付宝支付
     *
     * @param param
     * @return
     */
    @POST("pos/order/v2/alipay.do")
    Observable<Response_Base<Response_Pay>> doAliPay(@Body PayParams param);

    /**
     * 微信支付
     *
     * @param param
     * @return
     */
    @POST("pos/order/v2/wechat.do")
    Observable<Response_Base<Response_Pay>> doWechatPay(@Body PayParams param);

    /**
     * 二维码支付
     *
     * @param param
     * @return
     */
    @POST("/newapp/pay/qrPay.do")
    Observable<Response_Base<PayQrCode>> doQrPay(@Body PayParams param);

    /**
     * 收银台展示充值送活动
     *
     * @return
     */
    @POST("pos/member/queryBalTempOnly.do")
    Observable<Response_Base<Response_BalTemp>> doQueryBalTemp();

    /**
     * 订单关闭
     *
     * @param request_closeOrder clientOrderId orderId
     * @return
     */
    @POST("pos/order/closeOrder.do")
    Observable<Response_Base<Response_Pay>> closeOrder(@Body Request_CloseOrder request_closeOrder);


    /**
     *查询默认支付门店
     * @param request_payShopInfo
     * @return
     */
    @POST("app/config/getPayShopInfo.do")
    Observable<Response_Base<Response_PayShopInfo>> getPayShopInfo(@Body Request_PayShopInfo request_payShopInfo);

    @GET("app/magic/sendVerifyCode.no")
    Observable<Response_Base<Response_Pay>> sendMagicVerifyCode(@QueryMap Map<String, String> params);

    @POST("app/magic/login.no")
    Observable<Response_Base<Response_UserLogin>> magicLogin(@Body Request_UserLogin request);

    @GET("app/user/queryHuaBeiInfo.do")
    Observable<Response_Base<HuabeiService>> queryHuaBeiInfo(@QueryMap Map<String, String> params);

    /**
     * 设置默认支付门店,变更核销门店
     * @param request_setShopPay
     * @return
     */
    @POST("app/config/saveAndUpdateCommonConfig.do")
    Observable<Response_Base> saveAndUpdateCommonConfig(@Body Request_SetShopPay request_setShopPay);

    /**
     *
     * @param
     * @return
     * 查询bd手机号
     */
    @POST("newapp/shop/queryBdInfo.do")
    Observable<Response_Base<Response_BdInfo>> queryBdInfo();

    /**
     * 设备查询
     */
    @POST("newapp/machineTool/deviceQuery.do")
    Observable<Response_Base<List<DeviceEntity>>> deviceQuery(@Body Request_deviceQuery request_deviceQuery);


    /**
     *
     * @return
     * 读取掌柜App语音播报接收设置
     */
    @POST("newapp/setting/queryAppVoiceSet.do")
    Observable<Response_Base<Response_AppVoiceSet>> queryAppVoiceSet();

    /**
     *
     * @return
     * 语音播报各个类型开关设置
     * resultObject true
     */
    @POST("newapp/setting/userSwitchSetting.do")
    Observable<Response_Base<Response_UserSwitchSetting>> doUserSwitchSetting(@Body Request_userSwitchSetting request_userSwitchSetting);


    /**
     *  设置语音播报相关的限制条件
     * @param request_switchLimitationSetting
     * @return
     * resultObject true 成功失败
     */
    @POST("newapp/setting/switchLimitationSetting.do")
    Observable<Response_Base> doSwitchLimitationSetting(@Body Request_switchLimitationSetting request_switchLimitationSetting);


    /**
     * 门店列表设置
     * @return
     */
    @POST("newapp/setting/appVoiceShopListSet.do")
    Observable<Response_Base<Response_AppVoiceSet>> doAppVoiceShopListSet(@Body Request_shopList request_shopList);

    /**
     * 按照门店id查询码列表
     * @return
     */
    @POST("newapp/code/queryQrCodesByShopIdList.do")
    Observable<Response_Base<List<Response_PayQrCodeNew>>> doQueryQrCodesByShopIdList(@Body Request_deviceQuery request_deviceQuery);


}
